package com.nan.buy.service.Impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.nan.buy.common.UUIDUtil;
import com.nan.buy.dao.OrderDetailsMapper;
import com.nan.buy.model.OrderDetails;
import com.nan.buy.service.OrderDetailsService;

@Service
public class OrderDetailsServiceImpl implements OrderDetailsService {

	@Resource
	private OrderDetailsMapper orderDetailsMapper;

	@Override
	public List<OrderDetails> searchOrderDetailsByOrderId(String orderId) {
		return orderDetailsMapper.selectByOrderId(orderId);
	}

	@Override
	public int deleteByOrdersId(String oId) {
		return orderDetailsMapper.deleteByOrdersId(oId);
	}

	@Override
	public int deleteByPrimaryKey(String id) {
		return orderDetailsMapper.deleteByPrimaryKey(id);
	}

	//批量添加
	@Override
	public int insertList(List<OrderDetails> OrderDetailsList,String orderId) {
	
		for (OrderDetails orderDetails : OrderDetailsList) {
			orderDetails.setId(UUIDUtil.getUUID());
			orderDetails.setOrderId(orderId);
		}
		return orderDetailsMapper.insertList(OrderDetailsList);
	}
	
	
	
}
